﻿using JinJun.YShowReception.BLL.IService;
using JinJun.YShowReception.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace JinJun.YShowReception.Web.Controllers
{
    public class CommonController : Controller   //手机短信控制器
    {
        private ISmsInfoService _smsInfoService;
        public CommonController(ISmsInfoService smsInfoService)
        {
            _smsInfoService = smsInfoService;
        }

        /// <summary>
        /// 添加短信发送记录
        /// </summary>
        /// <param name="userInfo"></param>
        /// <returns></returns>
        public JsonResult AddSmsInfo(string tel)
        {
            //创建操作类对象
            Operate operate = new Operate();
            //调用添加短信发送记录
            operate.Success = _smsInfoService.AddSmsInfo(tel);
            return Json(operate);
        }


        /// <summary>
        /// 查询验证码是否存在
        /// </summary>
        /// <param name="userInfo"></param>
        /// <returns></returns>
        public JsonResult CheckCode(SmsInfo smsInfo)
        {
            //创建操作类对象
            Operate operate = new Operate();
            //调用查询验证码是否存在
            operate.Success = (_smsInfoService.CheckCode(smsInfo)) > 0;
            return Json(operate);
        }
    }
}